package tech.yunjing.train.service;


import tech.yunjing.train.entity.RedPacket;
import tech.yunjing.train.service.exception.RedPacketAmountException;
import tech.yunjing.train.service.exception.RedPacketNameException;
import tech.yunjing.train.service.exception.SmallRedPacketNumberException;

import java.util.List;

/**
 * Created by 刘飞 on 2017-6-8.
 */
public interface RedPacketService {
    /**
     * 根据红包名称 小红包数量 红包金额 来增加红包
     * @param redPacketName
     * @param redPacketAmount
     * @param smallPacketNumber
     * @return
     * @throws RedPacketAmountException
     * @throws SmallRedPacketNumberException
     * @throws RedPacketNameException
     */
    int addRedPacket(String redPacketName, Double redPacketAmount, Integer smallPacketNumber, String userAccount)throws RedPacketAmountException,SmallRedPacketNumberException,RedPacketNameException;

    /**
     * 红包的逻辑删除
     * @param redPacketName
     * @return
     * @throws RedPacketNameException
     */
    int  removePacket(String redPacketName, String userAccount)throws RedPacketNameException;

    /**
     * 红包的修改  根据红包名和 用户查询 修改其金额和数量
     * @param redPacketName
     * @param smallRedPacketNumber
     * @param redPacketAmount
     * @param userAccount
     * @return
     * @throws RedPacketAmountException
     * @throws SmallRedPacketNumberException
     * @throws RedPacketNameException
     */
    int updateRedPacket(String redPacketName, Integer smallRedPacketNumber, Double redPacketAmount, String userAccount) throws RedPacketAmountException, SmallRedPacketNumberException, RedPacketNameException;

    /**
     * 红包的查找
     * @return
     */
    List<RedPacket> findAllByLogicDelete();

    /**
     * 根据红包名称来查找红包
     * @param redPacketName
     * @return
     * @throws RedPacketNameException
     */
    RedPacket findRedPacketByRedPacketName(String redPacketName, String userAccount)throws RedPacketNameException;

}
